package arr_sum

/*
	求子数组中宝行相等的1与2的数量的子数组的最大长度
*/
func GetLongestOneEqualTwoSubArrMaxLength(arr []int) int {
	copyA := make([]int, len(arr))
	copy(copyA, arr)
	for i:=0; i<len(arr); i++ {
		if arr[i] == 1 {
			copyA[i] = 1
		} else if arr[i] == 2 {
			copyA[i] = -1
		} else {
			copyA[i] = 0
		}
	}
	return GetLongestSumSubArrayLength(copyA, 0)
}
